package com.example.basic.controller;

import com.example.basic.aop.OperationLogAnnotation;
import com.example.basic.domain.Todo;
import com.example.basic.reslut.ResponseResult;
import com.example.basic.service.TodoService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author mjw
 * @date 2023/3/31
 */
@RestController
@RequestMapping("/todo")
@CrossOrigin
public class TodoController {

    private final TodoService todoService;

    public TodoController(TodoService todoService) {
        this.todoService = todoService;
    }

    @OperationLogAnnotation(operModel = "待办模块-待办列表", operType = "查询", operDesc = "根据条件查询待办信息")
    @GetMapping("/selectTodo")
    public ResponseResult<List<Todo>> selectTodo(Todo todo) {
        return ResponseResult.success(todoService.selectTodo(todo));
    }
}
